// import { uploadUrl } from "../resource/https";
// import { formatDate } from "../../assets/resource/filter";
// import pinyin from 'js-pinyin';
import  { getAdmin } from '@A/resource/admin';
import { Toast,Dialog } from "vant";
let publicMixins = {
  data() {
    return {
      loading: false,
      infoData: '',
      finished: false, // 无限加载 是否加载完成
    }
  },
  mounted() {
  },
  methods: {
    // 返回
    returnBtn(key){
      if(key == '1'){
        this.$router.push({path:'/'}); // 
        return false
      }
      if (window.history.length <= 1) {
        this.$router.push({path:'/user-info'});
        return false
      } else {
        this.$router.go(-1);
      }
    },
    returnHome(){
      this.$router.push({path:'/user-info'});
    },
    promptBtn(val,key){
      if(val == '1'){
        Toast(key); // 普通提示
      }
      if(val == '2'){
        Toast.success(key); // 成功提示
      }
      if(val == '3'){
        Toast.fail(key); // 失败提示
      }
    },
    // 判断是否为微信浏览器
    isWeixinBrowser() {
      let ua = navigator.userAgent.toLowerCase();
      return /micromessenger/.test(ua) ? true : false;
    },
    // 退出
    exitBtn(){
      Dialog.confirm({
        title: '提示',
        message: '您是否确认退出当前登录?',
      })
      .then(() => {
        // on confirm
        window.localStorage.clear();
        this.$router.push({path:'/'});
      })
      .catch(() => {
        // on cancel
      });
    }
  },
  watch:{
    // 加载loading最多默认时长隐藏
    "loading"(){
      if(this.loading){
        setTimeout(() => {
          this.loading = false;
        }, 10000);
      }
    }
  }
};
export default publicMixins
